package com.cpi.cornpp.distributionpotoplants.service;

import com.cpi.cornpp.common.exception.CornPPException;
import com.cpi.cornpp.distributionpotoplants.dao.DistributionPOToPlantDAO;
import com.cpi.cornpp.distributionpotoplants.exception.DistributionPOToPlantException;

public class DistributionPOToPlantService {
	public void add(int versionId) throws DistributionPOToPlantException{
		DistributionPOToPlantDAO distributionPOToPlantDAO = null;
		try{			
			distributionPOToPlantDAO = new DistributionPOToPlantDAO();
			distributionPOToPlantDAO.add(versionId);
		} catch (DistributionPOToPlantException distributionPOToPlantException) {
			throw distributionPOToPlantException;
		} catch (Exception e){
			DistributionPOToPlantException distributionPOToPlantException = null;
			e.printStackTrace(System.out);
			distributionPOToPlantException = new DistributionPOToPlantException(e , CornPPException.LAYER_SERVICE,CornPPException.ACTION_INSERT);
			throw distributionPOToPlantException;
		}
	}
	
	public void delete(int versionId) throws DistributionPOToPlantException{
		DistributionPOToPlantDAO distributionPOToPlantDAO = null;
		try{
			distributionPOToPlantDAO = new DistributionPOToPlantDAO();
			distributionPOToPlantDAO.delete(versionId);
		} catch (DistributionPOToPlantException distributionPOToPlantException) {
			throw distributionPOToPlantException;
		} catch (Exception e){
			DistributionPOToPlantException distributionPOToPlantException = null;
			e.printStackTrace(System.out);
			distributionPOToPlantException = new DistributionPOToPlantException(e , CornPPException.LAYER_SERVICE,CornPPException.ACTION_INSERT);
			throw distributionPOToPlantException;
		}
	}
}